﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace LO1200.Web.UI
{
    [DataContract]
    public class Tweet
    {
        /// <summary>
        /// Gets the ID of the <see cref="T:LO1200.Web.UI.Tweet"/>.
        /// </summary>
        [DataMember]
        public long ID
        {
            get;
            private set;
        }
        /// <summary>
        /// Gets username of the <see cref="T:LO1200.Web.UI.Tweet"/> author.
        /// </summary>
        [DataMember]
        public string AuthorUsername
        {
            get;
            private set;
        }
        /// <summary>
        /// Gets the name of the <see cref="T:LO1200.Web.UI.Tweet"/> author.
        /// </summary>
        [DataMember]
        public string AuthorName
        {
            get;
            private set;
        }
        /// <summary>
        /// Gets the date of the <see cref="T:LO1200.Web.UI.Tweet"/>.
        /// </summary>
        [DataMember]
        public DateTime Date
        {
            get;
            private set;
        }
        /// <summary>
        /// Gets the <see cref="T:LO1200.Web.UI.Tweet"/> content.
        /// </summary>
        [DataMember]
        public string Content
        {
            get;
            private set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:LO1200.Web.UI.Tweet"/> class.
        /// </summary>
        /// <param name="id">The ID of the <see cref="T:LO1200.Web.UI.Tweet"/>.</param>
        /// <param name="author">The author of the <see cref="T:LO1200.Web.UI.Tweet"/>.</param>
        /// <param name="date">The date of the <see cref="T:LO1200.Web.UI.Tweet"/>.</param>
        /// <param name="content">The <see cref="T:LO1200.Web.UI.Tweet"/> content.</param>
        public Tweet(long id, string author, DateTime date, string content)
        {
            // TODO: extract the username and name from the author
            // format "Username (Name)"
            // author URL = http://twitter.com/<AuthorUserName>

            ID = id;
            AuthorUsername = author;
            AuthorName = author;
            Date = date;
            Content = content;
        }
    }
}
